<?php

namespace App\Http\Controllers\UserApi;

use App\Http\Controllers\Controller;
use App\Services\Admin\SystemSet;

class SystemSetController extends Controller
{
    public function index()
    {
        $result = [
            'leave'=>SystemSet::info('leave'),
            'make_up'=>SystemSet::info('make_up'),
            'optional_course'=>SystemSet::info('optional_course'),
            //积分方案规则
            'integral_rul'=>SystemSet::info('integral_rul'),
            'user_service_rul'=>SystemSet::info('user_service_rul'),
            'cash_coupon_rul'=>SystemSet::info('cash_coupon_rul'),
            'goods_rul'=>SystemSet::info('goods_rul'),
        ];
        return self::success($result);
    }

    public function announcement()
    {
        $first = SystemSet::system_message();

        if(empty($first))return self::fail('没有公告!');
        if($first->is_open == '-1')return self::fail('没有公告!');

        return self::success($first);
    }
}
